function BigInteger(string) {
    let bigint = BigInt(string);
    this.toString = function() {
        return bigint + '';
    }
    this.toBinaryString = function() {
        let b = this.toString();
        let q = b;
        let rem;
        let s = '';
        let length = 0;
        while (q != 0) {
            rem = q % 2;
            s = rem + s;
            q = Math.floor(q / 2);
        }
        length = s.length;
        for (let i = 1; i <= 32 - length; i++) {
            s = '0' + s;
        }
        return s;
    }
    this.toHexString = function() {
        let b = this.toString();
        let q = b;
        let rem;
        let s = '';
        let array = ['A', 'B', 'C', 'D', 'E', 'F'];
        while (q != 0) {
            rem = q % 16;
            if (rem < 10) {
                s = rem + s;
            } else {
                s = array[rem % 10] + s;
            }
            q = Math.floor(q / 16);
        }
        return s;
    }
}
// string 值转换为 bigint 值
let x = new BigInteger('9527');
console.log(x.toString());

//十进制整数转换为 二进制形式
let d = new BigInteger('9');
let s = d.toBinaryString();
console.log(s);

//十进制整数转换为 十六进制形式
let h = new BigInteger('2147483647');
let H = h.toHexString();
console.log(H);